﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;

namespace BAL
{
    public class RolBAL
    {
        public RolBAL() { }


        public List<DAL.Entities.RolEntity> GetRoles()
        {
            try
            {
                DAL.RolDAL dal = new RolDAL();
                return dal.GetRoles();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        /// <summary>
        /// Funcion que borra un rol
        /// </summary>
        /// <returns></returns>
        public bool DeleteRol(DAL.Entities.RolEntity rol)
        {
            try
            {
                DAL.RolDAL dal = new RolDAL();
                return dal.DeleteRol(rol);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }


        public DAL.Entities.RolEntity GetRolById(DAL.Entities.RolEntity _rol)
        {
            try
            {
                DAL.RolDAL dal = new RolDAL();
                return dal.GetRolById(_rol);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }


        public DAL.Entities.RolEntity AddRol(DAL.Entities.RolEntity rol)
        {
            try
            {
                DAL.RolDAL dal = new RolDAL();
                return dal.AddRol(rol);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public bool UpdateRol(DAL.Entities.RolEntity rol)
        {
            try
            {
                DAL.RolDAL dal = new RolDAL();
                return dal.UpdateRol(rol);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}
